package com.gui.mapper;

import com.gui.model.User;
import org.apache.ibatis.annotations.*;
import org.springframework.scheduling.support.SimpleTriggerContext;
import org.springframework.stereotype.Component;

/**
 * Usermapper
 *
 * @author guigu
 * @QQ 1170258867
 * @date 2020/5/27
 * @description
 */
@Component
@Mapper
public interface UserMapper {
    @Insert("insert into USER(ACCOUNT_ID,NAME, TOKEN, GMT_CREATE, GMT_MODIFIED,AVATAR_URL) values (#{accountId},#{name},#{token},#{gmtCreate},#{gmtModified},#{avatarUrl})")
    void insert(User user);

    @Select("select NAME from  USER where ACCOUNT_ID = #{accountId}")
    String selectName(String accountId);

    @Select("select * from  USER where ID = #{id}")
    User selectById(int id);

    @Update("update USER set NAME= #{name},TOKEN = #{token},AVATAR_URL = #{avatarUrl} where ACCOUNT_ID = #{accountId}")
    int update(User user);

    @Select("select * from  USER where TOKEN = #{value}")
    User findbytoken(String value);
}
